﻿function ShowInterviewerContent(contentMenu) {
    $('.analytics-menu li').removeClass('active');
    $(contentMenu).addClass('active');
    $('.interviewer-autocontent').removeClass('interviewer-autocontent-visible');
    $(contentMenu).data('assoc').addClass('interviewer-autocontent-visible');
}

$(function () {
    $('.analytics-menu li').each(function () {
        var $li = $(this);
        var $cnt;
        if ($li.attr('forc') != '') {
            $cnt = $('#' + $li.attr('forc'));
        }
        if ($cnt && $cnt.is('*')) {
            $li.data('assoc', $cnt);
            $cnt.addClass('interviewer-autocontent');
            $li.css('cursor', 'pointer').click(function (e) {
                e.preventDefault();
                e.stopPropagation();
                ShowInterviewerContent($(this));
            });
        } else {
            $li.remove();
        }
    });
    var q = $('#hfStartMenu');
    if (q.length == 1) q = parseInt($('#hfStartMenu').val());
    else q = undefined;
    if (!q) q = 0;
    if (q >= $('.analytics-menu li').length) q = 0;
    ShowInterviewerContent($('.analytics-menu li:eq(' + q + ')'));
    $(window).load(function () {
        if (window.parent.HideInterviewerLoader)
            window.parent.HideInterviewerLoader();
    });
});